package jetbrains.buildServer.cuta.logic.sheet;

import org.jetbrains.annotations.NotNull;

/**
 * @author Leonid Bushuev from JetBrains
 */
public class Column
{
    @NotNull
    public final Table table;

    @NotNull
    private String myName;

    @NotNull
    private String myCaption;

    @NotNull
    public String myOnClickRef;

    boolean mySortedAsc;
    boolean mySortedDesc;


    public Column(@NotNull Table table, @NotNull String name, String caption)
    {
        this.table = table;
        this.myName = name;
        this.myCaption = caption;
    }


    @NotNull
    public String getName() {
        return myName;
    }

    public void setName(@NotNull String name) {
        this.myName = name;
    }


    @NotNull
    public String getCaptionForShow()
    {
        return myCaption != null ? myCaption : myName;
    }

    @NotNull
    public String getCaption()
    {
        return myCaption;
    }

    public void setCaption(@NotNull String caption)
    {
        this.myCaption = caption;
    }


    @NotNull
    public String getOnClickRef()
    {
        return myOnClickRef;
    }


    public void setOnClickRef(@NotNull String onClickRef)
    {
        myOnClickRef = onClickRef;
    }


    public boolean isSortedAsc()
    {
        return mySortedAsc;
    }


    public void setSortedAsc(boolean sortedAsc)
    {
        mySortedAsc = sortedAsc;
    }


    public boolean isSortedDesc()
    {
        return mySortedDesc;
    }


    public void setSortedDesc(boolean sortedDesc)
    {
        mySortedDesc = sortedDesc;
    }


    @Override
    public String toString()
    {
        return myName;
    }
}
